Convert a list of strings [ '3', '1' , '2'] to a list of sorted integers [ 1, 2, 3] in Python, how?
Posted
by Shamim
on Stack Overflow
See other posts from Stack Overflow
or by Shamim
Published on 2010-04-23T00:40:33Z
Indexed on
2010/04/23
0:43 UTC
Read the original article
Hit count: 286
I have: L1 = ['11', '10', '13', '12', '15', '14', '1', '3', '2', '5', '4', '7', '6', '9', '8'] this is a list of strings, right? I need to make it a list of integers as follows: L2 = [11, 10, 13, 12, 15, 14, 1, 3, 2, 5, 4, 7, 6, 9, 8]
finally I will sort it like below: L3 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] by L2.sort()
please let me know how I can get to L3 from L1
© Stack Overflow or respective owner